<?php
$time_out = 60;
if(empty($_SESSION['timeout'])){
    $_SESSION['timeout'] = time();
} else {
    $inactive_time = time() - $_SESSION['timeout'];
    if($inactive_time > $time_out){
        $_SESSION['timeout'] = time();
    }
}
?>

<div class="ui orange pointing menu">
    <a href="<?php echo LINK_ROOT . '/index.php' ?>" class="active item">
        <i class="home icon"></i>Home
    </a>
<!--    <div class="ui dropdown item">
        <i class="ticket icon"></i>
        Session Times<i class="dropdown icon"></i>
        <div class="menu">
            <a href="<?php echo LINK_ROOT . '/show_by_movie.php' ?>" class="item">By Movie</a>
            <a href="<?php echo LINK_ROOT . '/show_by_cinema.php' ?>" class="item">By Cinema</a>
            <a href="<?php echo LINK_ROOT . '/show_by_date.php' ?>" class="item">By Date</a>
        </div>
    </div>-->
    <div class="ui dropdown item">
        <i class="video icon"></i>
        Movies<i class="dropdown icon"></i>
        <div class="menu">
            <a href="<?php echo LINK_ROOT . '/now_showing.php' ?>" class="item">Now Showing</a>
            <a href="<?php echo LINK_ROOT . '/coming_soon.php' ?>" class="item">Coming Soon</a>
        </div>
    </div>
    <a href="<?php echo LINK_ROOT . '/cinema.php' ?>" class="item">
        <i class="block layout icon"></i> Cinemas
    </a>
    <a href="<?php echo LINK_ROOT . '/combo.php' ?>" class="item">
        <i class="thumbs up icon"></i> Combos
    </a>
    <?php
    if (!empty($_SESSION['user_login']) && $_SESSION['user_login'] === "logined") { ?>
    <div class="right menu">
        <div class="ui dropdown item">
            Hi, <?php echo $_SESSION['user_info']['email'] ?><i class="dropdown icon"></i>
            <div class="menu">
                <a class="item" href="<?php echo LINK_ROOT; ?>/logout.php">Logout</a>
            </div>
        </div>
    </div>
    <?php
    } else { ?>
    <div class="right menu">
        <a class="item" href="<?php echo LINK_ROOT; ?>/register.php">
            Register
        </a>
        <a class="item" href="<?php echo LINK_ROOT; ?>/login.php">
            Login
        </a>
    </div>
    <?php
    } ?>
    
</div>